<?php
declare(strict_types=1);
namespace App\Libs;



class Token {

    public static function getUser($token)
    {
    	return Cache::get($token);
    }
    public static function setToken($token, $user){
    	return Cache::set($token, $user, 60 * 60 * 24 * 30);
    }
    public static function removeToken($token){
    	return Cache::delete($token);
    }

    public static function uuid($user_id){  
	    $chars = md5(uniqid(mt_rand().$user_id, true));  
	    $uuid = substr ( $chars, 0, 8 ) . '-'
	            . substr ( $chars, 8, 4 ) . '-' 
	            . substr ( $chars, 12, 4 ) . '-'
	            . substr ( $chars, 16, 4 ) . '-'
	            . substr ( $chars, 20, 12 );  
	    return $uuid ;  
	}  
}